<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.welfare.admin.system.*" %>
<%
	String idx				= StringUtil.nvl(request.getParameter("idx"),"0");
	String s_docu_name		= StringUtil.nvl(request.getParameter("s_docu_name"));


	HashMap infos = new HashMap();
	infos.put("docu_name",	s_docu_name);
	infos.put("sort_col", "docu_name");
	
	SystemDAO dao 	= new SystemDAO();
	HashList list 	= dao.selectDocumentList(infos);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= SYSTEM_NAME %></title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>

	<script type="text/javascript">
	
	
	$(document).ready(function() {
		$('#s_docu_name').focus().select();
		$('#list').find('tr').hover(
				function () { $(this).addClass("hover"); }
			  , function () { $(this).removeClass("hover"); }
			)
		$('#list').find('td.docu_name').click(function(){
			if ($(opener.document).find('input[name="list.job_type"]:eq(<%=idx%>)').val() != 'C') {
				$(opener.document).find('input[name="list.job_type"]:eq(<%=idx%>)').val('U');
			}
			$(opener.document).find('input[name="list.docu_id"]:eq(<%=idx%>)').val($(this).closest('tr').find('input[name="docu_id"]').val());
			$(opener.document).find('input[name="list.docu_name"]:eq(<%=idx%>)').val($(this).closest('tr').find('input[name="docu_name"]').val());
			self.close();
		});
	});

	function fnSelectDocu() {
		
	}

	</script>
</head>
<body>
<div id="wrap">
	<div id="popup">
		<div class="menu_title">
			<h1>서식 선택</h1>
			<div class="r mt2"></div>
		</div>
		<div class="clear line_01"></div>

		<form id="searchForm" name="searchForm" action="./selectDocument.jsp" method="post" >

		<table cellpadding="0" cellspacing="0" class="mt5">
			<colgroup>
				<col width="100px"/>
				<col/>
			</colgroup>
			<tbody>
				<tr>
					<th><p><label for="docu_name">서식명</label></p></th>
					<td>
						<input type="text" name="s_docu_name" id="s_docu_name" value="<%= s_docu_name %>" class="w200"/><input type="image" class="button" src="../images/ico_popup.gif" align="absmiddle"/>
					</td>
				</tr>
			</tbody>
		</table>
		
						
		</form>
		
		<div class="mt5">
		
		
			<table cellpadding="0" cellspacing="0" >
				<colgroup>
					<col />
					<col width="200px"/>
					<col width="100px"/>
				</colgroup>
				<thead>
					<tr>
						<th><p>서식명</p></th>
						<th><p>저장위치</p></th> 
						<th><p>다운로드</p></th> 
					</tr>
				</thead>
				<tbody id="list">
			<%	for (int i = 0; i < list.size(); i++) { %>
					<tr>
						<td class="docu_name">
							<input type="hidden" name="docu_id" value="<%= list.get("docu_id", i) %>"/>
							<input type="hidden" name="docu_name" value="<%= list.get("docu_name", i) %>"/>
							<%= list.get("docu_name", i) %>
						</td>
						<td class="docu_name">
							<%= list.get("file_path", i) %>
						</td>
						<td class="c"><a href="../../common/fileDownload.jsp?file_id=<%= list.get("file_id", i) %>&file_name=<%=list.getEncode("docu_name",i)+"."+list.getEncode("file_ext",i) %>"><img src="../images/ico_download.gif"/></a></td>
					</tr>
			<%	} %>
				</tbody>
			</table>
		</div>

		<div class="mt20 mb10 c">
			<a href="#nohref" onclick="self.close()"><img src="../images/btn_close.gif" /></a>
		</div>
	
	</div>
</div>

</body>
</html>
